<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //数组去重
        let arr = [1,2,3,4,5,6,34,5,3,2,3,4,5,6,7];
        let newArr = arr.reduce((pre,cur)=>{
            if(pre.includes(cur) === false){
                return pre.concat(cur);
            }else{
                return pre;
            }
        },[])
        //console.log(newArr);
        let set = new Set(arr);
        //console.log(set);


        //字符串去重
        let str = 'aaabbbvvvddswidnxnxjnnsdsdajiwieiidjnzsjd';
        let set1 = new Set(str);
        let res = [...set1].join('');
        console.log(res);
        
    </script>
</body>
</html>